using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Nihonaid.classes;

namespace Nihonaid
{
    public partial class QueueStatusForm : Form
    {
        public QueueStatusForm()
        {
            InitializeComponent();
        }

        private void QueueStatusForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Program.learning_form.Show();
        }

        private void QueueStatusForm_Load(object sender, EventArgs e)
        {
            dgReview.Columns.Add("Item", "Item");
            dgReview.Columns.Add("NextReview", "Next Review");
            foreach (LearningItem item in Program.queue.review_queue)
            {
                int days_left = item.NextRepetitionDate.DayOfYear - DateTime.Now.DayOfYear;
                if (days_left < 0)
                    days_left = 0;
                dgReview.Rows.Add(new object[2] { item.Question, item.NextRepetitionDate.ToShortDateString() + " (" + days_left + " days)" });
            }

            dgLearning.Columns.Add("Item", "Item");
            foreach (LearningItem item in Program.queue.learning_queue)
                dgLearning.Rows.Add(new object[1] { item.Question });
        }
    }
}